// AcadExt.cpp: implementation of the AcadExt class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "AcadExt.h"
#include "UEEntityOperation.h"

namespace AcadExt
{

 AcDb3dPolyline* GenerateDbPolyline( AcGePoint3dArray& arPt, AcDbHandle& hdl )
{
	AcDb3dPolyline* pl = new AcDb3dPolyline ( AcDb::k3dSimplePoly, arPt, Adesk::kTrue );
	Acad::ErrorStatus es = CUEEntityOperation::AddEntityToDwg ( pl );
	if ( es != Acad::eOk )
	{
		delete pl;
		return 0;
	}
	pl->getAcDbHandle ( hdl );
	return pl;
}

AcDbLine* GenerateDbLine( const AcGePoint3d& start, const AcGePoint3d& end, AcDbHandle& hdl )
{
	AcDbLine* line = new AcDbLine;
	line->setStartPoint( start );
	line->setEndPoint( end );
	if ( CUEEntityOperation::AddEntityToDwg ( line ) != Acad::eOk )
	{
		delete line;
		return 0;
	}
	line->getAcDbHandle ( hdl );
	return line;
}

}
